<template>
	<view class="info">
		<view class="info_border"></view>
		<view class="info_title font-323232 font17 font-b">{{type=='hang'?'预约/挂号须知':'就诊须知'}}</view>
		<view class="info_content">
			<rich-text :nodes="content"></rich-text>
		</view>
		<view class="info_radio flex-row-center">
			<radio-group @change="radioChange">
				<label>
					<radio style="transform:scale(0.8)" color="#6ccbb6" value="1" :checked="checked" />
				</label>
			</radio-group>

			<view class="font-323232 font14">我已阅读{{type=='hang'?'挂号':'就诊'}}须知</view>
		</view>
		<!-- 提交按钮 -->
		<view class="comment_submit flex-row-center font-ffffff font15" @click="OnfeedBack">
			<view class="flex-row-center">确认</view>
		</view>
		<view class="comment_submitx"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: '',
				type: '',
				checked: false,
				is_his:0,
			}
		},
		onLoad: function(options) {
			this.type = options.type
			uni.setNavigationBarTitle({
				title: options.type == 'hang' ? '预约/挂号须知' : '就诊须知'
			})
			this.Onconfig(options.type)
		},
		methods: {
			Onconfig(type) {
				this.$Http({
					url: 'consultationConsult',
					data: {}
				}).then(res => {
					if (res.code == 1) {
						this.is_his = res.data.is_his
						if (type == 'hang') {
							this.content = res.data.hang_num.replace(/\<img/g,
								'<img style="display: block;max-width: 100%;height: auto;"')
						} else {
							this.content = res.data.ask_diagnosis.replace(/\<img/g,
								'<img style="display: block;max-width: 100%;height: auto;"')
						}
					}
				})
			},
			radioChange(e) {
				this.checked = e.detail.value
			},
			OnfeedBack() {
				if (this.checked == 1) {
					if (this.type == 'hang') {
						uni.redirectTo({
							url: '/pagesA/common/list?type=hang&is_his='+this.is_his
						});
					} else {
						uni.redirectTo({
							url: '/pagesA/common/list?type=line'
						});
					}
				} else {
					setTimeout(() => {
						uni.pageScrollTo({
							scrollTop: 99999,
							duration: 0
						});
					}, 50);
					uni.showToast({
						title: '请先勾选同意须知',
						icon: 'none',
						duration: 2000
					})
				}
				console.log(this.checked, '//')
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
</style>
